package cn.edu.dgut.sai;

import org.springframework.beans.factory.config.BeanPostProcessor;
import org.springframework.stereotype.Component;

/**
 * @author Sai
 * Created by Sai on 2019/9/5.
 */
@SuppressWarnings("unused")
@Component
public class CustomBeanPostProcessor1 implements BeanPostProcessor {

    // simply return the instantiated bean as-is
    public Object postProcessBeforeInitialization(Object bean, String beanName) {
        return bean; // we could potentially return any object reference here...
    }

    public Object postProcessAfterInitialization(Object bean, String beanName) {
        System.out.println("Bean1 '" + beanName + "' created : " + bean.toString());
        return bean;
    }
}
